<?php
/**
 ** 为解决1234开奖网首页访问慢的问题 定时清理表
 ** 修改原先emptyController下的定时到crontab下
**/
set_time_limit(0);
date_default_timezone_set("PRC");

require 'db_config.php';
//1.连接数据库->pdo方式
$db_pdo_link = pdo_write_read_link();

if(!$db_pdo_link)
{
	die('pdo connection failed!');
}
		/*
		高频率彩
			34 => 'ahk3',    //安徽快3        
			20 => 'bjpk10',  //北京赛车pk10
			1 => 'cqssc',	 //重庆时时彩
			21 => 'gdklsf',	 //广州快乐十分
			23 => 'bjkl8',   //快乐8
			3 => 'tjssc',    //天津时时彩
			18 => 'cqklsf',  //重庆农场
			22 => 'jsk3',    //江苏快3
			66 => 'mlaft',  //幸运飞艇
			6 => 'gd11x5',  //广东11选5
			7 => 'sd11x5',  //山东11选5
			16 => 'jx11x5', //江西11选5
			69 => 'tjklsf', //天津快乐十分 
		低频彩
			24 => 'shssl',   //上海时时乐    一天23 10天
			9 => 'fc3d',    //福彩3D   1天一个   100天的 
			10 => 'pl3'     //排列三   1天一个    100天的    
			67 => 'qxc',     //七星彩  一周3个  67周 一年的
			35 => 'hk6',    //香港六合彩 一周3个 67周一年的

		*/
   // 获取3天前的时间  
   $deltime = strtotime("now")-3600*24*3;
   $deltime10 = strtotime("now")-3600*24*10;
   $deltime100 = strtotime("now")-3600*24*100;
   $deltime300 = strtotime("now")-3600*24*300;

    deldata($db_pdo_link,$deltime,34);
    deldata($db_pdo_link,$deltime,20);
    deldata($db_pdo_link,$deltime,1);
    deldata($db_pdo_link,$deltime,21);
    deldata($db_pdo_link,$deltime,23);
    deldata($db_pdo_link,$deltime,3);
    deldata($db_pdo_link,$deltime,18);
    deldata($db_pdo_link,$deltime,22);
    deldata($db_pdo_link,$deltime,66);
    deldata($db_pdo_link,$deltime,6);
    deldata($db_pdo_link,$deltime,7);
    deldata($db_pdo_link,$deltime,16);
    deldata($db_pdo_link,$deltime,69);
	//低频彩
    deldata($db_pdo_link,$deltime10,24);
    deldata($db_pdo_link,$deltime100,9);
    deldata($db_pdo_link,$deltime100,10);
    deldata($db_pdo_link,$deltime300,67);
    deldata($db_pdo_link,$deltime300,35);



/**
 ** 删除数据
 ** added by zj@2018/01/16
 ** @param $pdo_write_read_link[object  数据库链接]
 ** @param $type [string  彩种类型]
 ** @param $except [string  开奖期数]
**/
function deldata($db_pdo_link,$deltime,$type)
{ 

    $del_sql  = "delete from lot_data where  dat_type=$type and  dat_open_time < $deltime ";
	$del_result = $db_pdo_link->exec($del_sql);
	

}












